<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class adminlayout{

    var $obj;
    var $layout;

    function adminlayout($layout = ""){
        
        $this->obj =& get_instance();
        $this->layout = $layout;
    }

    function setLayout($layout){
        
      $this->layout = $layout;
      
    }

    function view($view, $data=null, $title = 'admin', $return=false){
        
        $loadedData = array();
        $loadedData['title'] = $title;
        $loadedData['view'] = $view;
        $loadedData['content'] = $data;
        //$loadedData['content_for_layout'] = $this->obj->load->view($view,$data,true);
        if($return){
            
            $output = $this->obj->load->view($this->layout, $loadedData, true);
            return $output;
            
        }
        else{
            
            $this->obj->load->view($this->layout, $loadedData, false);
            
        }
    }
}